package com.weiz.designpatterns.adapter;

public class PegAdapter implements IRoundPeg,ISquarePeg {
    private RoundPeg roundPeg;
    private SquarePeg squarePeg;

    // 构造方法
    public PegAdapter(RoundPeg peg) {
        this.roundPeg = peg;
    }

    // 构造方法
    public PegAdapter(SquarePeg peg) {
        this.squarePeg = peg;
    }

    @Override
    public void insertIntoHole(String str) {
        roundPeg.insertIntoHole(str);
    }

    @Override
    public void insert(String str) {
        squarePeg.insert(str);
    }
}